<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_auction.*" %>
<%@page import="com.lmpop.trade.ts_category.*" %>
<%@page import="java.util.*" %>
<html>
  <head>
    
    <title>拍卖信息管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="auction.js"></script>
	
	<script type="text/javascript" >
		function ssearchGoods(){		
			var searchData = '';
			searchData = 's_goods_name='+$('#goods_name').val();
			$.ajax({
			   type: "POST",
			   url: "searchGoods.jsp",
			   data: searchData,
			   success: function(msg){
				 $("#goods_id").html(msg);
			   }
			 });
	 
		}		
	</script>
	
</head>

<body >

  <% 
	Hashtable ti_auction = new Hashtable();
	
  	String auction_id="";
  	if(request.getParameter("auction_id")!=null) {
		auction_id = request.getParameter("auction_id");
		ti_auction.put("auction_id",auction_id);
	}
//	String good_id_1 ="";
 // 	if(request.getParameter("good_id")!=null) {
//		good_id_1 = request.getParameter("good_id");
//		ti_auction.put("good_id",good_id_1);
//	}
	
  	Ti_auctionInfo ti_auctionInfo = new Ti_auctionInfo();
    
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_auctionInfo.getListByPage(ti_auction,Integer.parseInt(iStart),limit);
  
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String good_name="",auction_name="",auction_desc="",good_id="",start_date="",end_date="",start_price="",a_price="",rate_price="",margin="",user_id="",in_date="";
  	if(map.get("auction_name")!=null) auction_name = map.get("auction_name").toString();
  	if(map.get("auction_desc")!=null) auction_desc = map.get("auction_desc").toString();
  	if(map.get("good_id")!=null) 
	good_id = map.get("good_id").toString();
	
	if(map.get("good_name")!=null) 
	good_name = map.get("good_name").toString();
	
  	if(map.get("start_date")!=null){
  		 start_date = map.get("start_date").toString();
  		  start_date=start_date.substring(0,19);
  	}
  	if(map.get("end_date")!=null){
  		 end_date = map.get("end_date").toString();
  		  end_date=end_date.substring(0,19);
  	}
  	if(map.get("start_price")!=null) start_price = map.get("start_price").toString();
  	if(map.get("a_price")!=null) a_price = map.get("a_price").toString();
  	if(map.get("rate_price")!=null) rate_price = map.get("rate_price").toString();
  	if(map.get("margin")!=null) margin = map.get("margin").toString();
  	if(map.get("user_id")!=null) user_id = map.get("user_id").toString();
  	if(map.get("in_date")!=null){
  		 in_date = map.get("in_date").toString();
  		 in_date=in_date.substring(0,19);
  	}
	
	
	Ts_categoryInfo categoryInfo = new Ts_categoryInfo();
	String cateString = categoryInfo.getSelCatByTLevel("2","1");

  %>
	
	<h1>修改拍卖信息</h1>
	
	<form action="/doTradeReg.do" method="post" name="addForm">
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		
		<tr>
			<td align="right" width="15%">
				活动名称<font color="red">*</font>
			</td>
			<td><input name="auction_name" id="auction_name" size="50" maxlength="20" value="<%=auction_name %>" type="text" /></td>
		</tr>
				
		<tr>
			<td align="right" width="20%">
				活动描述:<font color="red">*</font>
			</td>
			<td  colspan="3">
	
			<textarea name="auction_desc" id="auction_desc" ><%=auction_desc%></textarea> 
			<script type="text/javascript" src="/program/plugins/ckeditor/ckeditor.js"></script>
			<script type="text/javascript">
			   CKEDITOR.replace( 'auction_desc',{
			   	filebrowserUploadUrl : '/program/inc/upload.jsp?type=file&attach_root_id=<%=auction_id%>',      
                filebrowserImageUploadUrl : '/program/inc/upload.jsp?type=img&attach_root_id=<%=auction_id%>',      
                filebrowserFlashUploadUrl : '/program/inc/upload.jsp?type=flash&attach_root_id=<%=auction_id%>'     
				});  
			</script>
			
			</td>
		</tr>
	
		<tr>
				<td width="15%" align="right">
				<b>搜索商品：</b>&nbsp;&nbsp;
				</td>
				<td width="85%" align="left">
					<select name="goods_type" id="goods_type">
						<option value="">
							请选择类别
						</option>
						<%=cateString%>
					</select>
					商品名称:
					<input type="text" name="s_good_name" id="s_good_name" 
						maxlength="30" size="15" value="" />
					<span> <input type="button" name="submit_form2"
							id="submit_form2" value="搜索" onclick="return searchGoods()"
							style="height: 23px; text-align: center" /> </span>
				</td>
			</tr>
	
				<tr>
					<td width="15%" align="right">
						<b>拍卖商品名称<font color="red">*</font>&nbsp;&nbsp;</b>
					</td>
					<td align="left">
						<div >
							<select name="good_id" id="good_id">
								<option value="<%=good_id%>"><%=good_name%></option>
							</select>
						</div>
					</td>
				</tr>
		
	
		
		
		<tr>
			<td align="right" width="10%">
				拍卖开始时间<font color="red">*</font>
			</td>
			<td>
<input name="start_date" type="text" id="start_date" class="Wdate" value="<%=start_date %>" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'end_date\',{d:-1})}',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" size="25"  width="150px"/>

			</tr>
		
		<tr>
			<td align="right" width="10%">
				拍卖结束时间<font color="red">*</font>
			</td>
			<td>
 <input name="end_date" id="end_date" type="text" class="Wdate" value="<%=end_date %>" onClick="WdatePicker({minDate:'#F{$dp.$D(\'start_date\',{d:1})}',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" size="25" width="150px"/>

			</tr>
		
		<tr>
			<td align="right" width="10%">
				起拍价:<font color="red">*</font>
			</td>
			<td><input name="start_price" id="start_price" size="20" maxlength="20" value="<%=start_price %>" type="text" onKeyUp="if(!/^[1-9][0-9]*$/.test(this.value))this.value='1';"/><font color="red">&nbsp; *起拍价只能是正整数!</font></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				一口价:
			</td>
			<td><input name="a_price" id="a_price" size="20" maxlength="20" value="<%=a_price %>" type="text" onKeyUp="if(!/^[1-9][0-9]*$/.test(this.value))this.value='1';"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				加价幅度:
			</td>
			<td><input name="rate_price" id="rate_price" size="20" maxlength="20" value="<%=rate_price %>" type="text" onKeyUp="if(!/^[1-9][0-9]*$/.test(this.value))this.value='1';"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				保证金:
			</td>
			<td><input name="margin" id="margin" size="20" maxlength="20" value="<%=margin %>" type="text" onKeyUp="if(!/^[1-9][0-9]*$/.test(this.value))this.value='0';"/></td>
		</tr>
				
		<tr>
			<td align="right" width="10%">
				录入时间:
			</td>
			<td><input name="in_date" id="in_date" size="20" maxlength="19" value="<%=in_date %>" type="text" readonly /></td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<!-- <input name="good_id" id="good_id" size="20" maxlength="20" value="<%=good_id %>" type="hidden" /> -->
				<input name="user_id" id="user_id" size="20" maxlength="20" value="<%=user_id %>" type="hidden" />
				<input type="hidden" name="bpm_id" value="0042" />
	  			<input type="hidden" name="auction_id" value="<%=auction_id %>" />
				<input type="button" class="buttoncss" name="tradeSub" value="提交" onclick="checkSub();"/>&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
